﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace 设计模式
{
    public partial class FrmSingletonPattern : Form
    {
        public FrmSingletonPattern()
        {
            InitializeComponent();
        }

        private void btnInstruction_Click(object sender, EventArgs e)
        {
            MessageBox.Show("一个类仅有一个实例，对该类的所有访问都指向此实例。");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            FrmSingletonPattern_Child instance = FrmSingletonPattern_Child.Instance;
            instance.Show();
            instance.BringToFront();
        }
    }
}
